package com.smxy.mall.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "fat_news")
@Data
public class News {
    @Id //主键Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;  //id 自动生成

    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Column(name = "createTime",updatable = false,nullable=false)
    private Date createTime; //创建时间
    @LastModifiedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime; //更新时间
    @CreatedBy
    @Column(name = "createUser",updatable = false,nullable=false)
    private String createUser; //创建者
    @LastModifiedBy
    private String updateUser; //更新者

    private Integer categoryId;
    private String title;
    private String info;
    private String cover;
    private String content;
}
